import 'dart:convert';
import 'package:homepad/iot/basic_types.dart';
import 'package:homepad/iot/message_def.dart';
import 'package:homepad/logger/logger.dart';

void main(List<String> arguments) {
  var msg = Message(
      method: MethodType.readRequest,
      data: AttributePathIB(
          endpoint: EndpointIds.empty,
          cluster: ClusterIds.empty,
          attribute: AttributeIds.empty)
  );
  logger.info(jsonEncode(msg.toJson()));

  const EndpointId targetEndpoint = 100;
  var req = Message(
      method: MethodType.writeRequest,
      data: AttributeDataIB(
        path: AttributePathIB(
            endpoint: targetEndpoint,
            cluster: ClusterIds.onOff,
            attribute: OnOffAttributeIds.onOff
        ),
        data: 0x12,
      ));
  logger.info("message: ${jsonEncode(req.toJson())}");
}